package com.itheima.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.demo.mapper.LoginMapper;
import com.itheima.demo.service.LoginService;
import com.itheima.xo.pojo.Login;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author :WuJunJie
 * packageName :com.itheima.demo.service.impl
 * fileName :LoginServiceImpl
 * creationTime :2022-11-11 15:57
 */
@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginMapper loginMapper;

    @Override
    public Login findById(String id) {
        Login login = loginMapper.selectById(id);
        return login;
    }
    @Override
    public Login findByUsername(String name) {
        LambdaQueryWrapper<Login> lqw = new LambdaQueryWrapper<>();
        lqw.eq(Login::getUsername, name);

        return loginMapper.selectOne(lqw);
    }
}
